home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / xf2.3-p / xf2 / xf2.3 / elements / RadioButton < prev    next >
Encoding:
Text File  |  1993-11-20  |  6.0 KB  |  179 lines

  1. # Program: xf
  2. # Description: handle radiobutton widgets
  3. #
  4. # $Header: RadioButton[2.3] Wed Mar 10 11:59:09 1993 garfield@garfield frozen $
  5.  
  6. global xfDefaultConf
  7. set xfDefaultConf(radiobutton) 4
  8.  
  9. ##########
  10. # Procedure: XFAdd.RadioButton
  11. # Description: add a radiobutton
  12. # Arguments: xfW - the widget
  13. #            xfName - a optional name
  14. #            xfType - add or config
  15. # Returns: none
  16. # Sideeffects: none
  17. ##########
  18. proc XFAdd.RadioButton {xfW xfName xfType} {
  19.   global xfStatus
  20.  
  21.   XFEditSetStatus "Inserting RadioButton..."
  22.   set xfName [XFMiscGetUniqueName $xfName radiobutton]
  23.   if {"$xfStatus(path)" == "."} {
  24.     if {"$xfType" == "add"} {
  25.       radiobutton .$xfName \
  26.         -text "$xfName" \
  27.         -relief raised
  28.     } {
  29.       radiobutton .$xfName
  30.     }
  31.  
  32.     XFMiscPositionWidget .$xfName
  33.     XFMiscBindWidgetTree .$xfName
  34.   } {
  35.     if {"$xfType" == "add"} {
  36.       radiobutton $xfStatus(path).$xfName \
  37.         -text "$xfName" \
  38.         -relief raised
  39.     } {
  40.       radiobutton $xfStatus(path).$xfName
  41.     }
  42.  
  43.     XFMiscPositionWidget $xfStatus(path).$xfName
  44.     XFMiscBindWidgetTree $xfStatus(path).$xfName
  45.   }
  46.  
  47.   incr xfStatus(elementCounter)
  48.   XFEditSetPath $xfStatus(path)
  49.   XFEditSetStatus "Inserting RadioButton...done"
  50. }
  51.  
  52. ##########
  53. # Procedure: XFConfig.RadioButton4
  54. # Description: configure a radiobutton
  55. # Arguments: xfW - the widget
  56. #            xfType - config type (add config)
  57. #            xfClass - the class we configure
  58. #            xfLeader - the leading window
  59. # Returns: none
  60. # Sideeffects: none
  61. ##########
  62. proc XFConfig.RadioButton4 {xfW xfType xfClass {xfLeader ""}} {
  63.   global xfConf
  64.   global xfStatus
  65.  
  66.   if {"$xfType" == "add"} {
  67.     set xfName radiobutton$xfStatus(elementCounter)
  68.   } {
  69.     set xfName [XFMiscPathName $xfW]
  70.   }
  71.   XFEditSetStatus "Calling parameter setting for Radiobutton..."
  72.  
  73.   # build widget structure
  74.   XFTmpltToplevel .xf${xfClass}Config4 400x530 \
  75.     "Radiobutton parameters:[XFMiscPathTail $xfW]" $xfLeader
  76.  
  77.   XFElementInit $xfW .xf${xfClass}Config4 $xfType $xfClass \
  78.     XFRadioButtonSetRadioButton4 parameters $xfName 4
  79.   XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass bg \
  80.     background Background "Background" XFRadioButtonSetRadioButton4
  81.   XFElementBitmap $xfW .xf${xfClass}Config4 $xfType $xfClass \
  82.     XFRadioButtonSetRadioButton4
  83.   XFElementFont $xfW .xf${xfClass}Config4 $xfType $xfClass font \
  84.     font Font "Font" XFRadioButtonSetRadioButton4
  85.   if {$xfConf(kanji)} {
  86.     XFElementFont $xfW .xf${xfClass}Config4 $xfType $xfClass kanjifont \
  87.       kanjiFont KanjiFont "Kanji font" XFRadioButtonSetRadioButton4
  88.   }
  89.   XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass fg \
  90.     foreground Foreground "Foreground" XFRadioButtonSetRadioButton4
  91.   XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass text text Text \
  92.     "Label" XFRadioButtonSetRadioButton4 $xfName
  93.   XFElementSize $xfW .xf${xfClass}Config4 $xfType $xfClass \
  94.     XFRadioButtonSetRadioButton4
  95.   XFElementTextVariable $xfW .xf${xfClass}Config4 $xfType $xfClass \
  96.     XFRadioButtonSetRadioButton4
  97.   XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass value value Value \
  98.     "Value" XFRadioButtonSetRadioButton4 $xfName
  99.   XFElementVariable $xfW .xf${xfClass}Config4 $xfType $xfClass \
  100.     XFRadioButtonSetRadioButton4
  101.   XFElementCommand $xfW .xf${xfClass}Config4 $xfType
  102.  
  103.   # save current parameter
  104.   if {$xfConf(kanji)} {
  105.     XFElementSave $xfW $xfClass {background bitmap command font kanjifont foreground height text textvariable value variable width}
  106.   } {
  107.     XFElementSave $xfW $xfClass {background bitmap command font foreground height text textvariable value variable width}
  108.   }
  109.  
  110.   # packing
  111.   pack append .xf${xfClass}Config4.params1 \
  112.               .xf${xfClass}Config4.params1.params2 {left fill expand}
  113.   pack append .xf${xfClass}Config4 \
  114.               .xf${xfClass}Config4.pathname {top fill frame center} \
  115.               .xf${xfClass}Config4.leave {bottom fill} \
  116.               .xf${xfClass}Config4.additional {bottom fill} \
  117.               .xf${xfClass}Config4.params1 {top fill expand}
  118.  
  119.   XFBindFormConnect .xf${xfClass}Config4.params1.params2 \
  120.     "XFRadioButtonSetRadioButton4 $xfW 0 $xfClass"
  121.  
  122.   XFEditSetStatus "Calling parameter setting for RadioButton...done"
  123. }
  124.  
  125. ##########
  126. # Procedure: XFRadioButtonSetRadioButton4
  127. # Description: set radiobutton parameters
  128. # Arguments: xfW - the widget
  129. #            xfType - the type of setting (1 = set always, 0 = set
  130. #                     only if permanent apply is on)
  131. #            xfClass - the class we configure
  132. #            xfParam1 - ignored parameter
  133. # Returns: none
  134. # Sideeffects: none
  135. ##########
  136. proc XFRadioButtonSetRadioButton4 {xfW xfType xfClass {xfParam1 ""}} {
  137.   global xfConf
  138.   global xfMisc
  139.  
  140.   if {$xfType == 0 && !$xfConf(applyParameters)} {
  141.     return
  142.   }
  143.   if {"[info commands $xfW]" == ""} {
  144.     return
  145.   }
  146.   XFMiscSetSymbolicName $xfW \
  147.     [.xf${xfClass}Config4.params1.params2.symname.symname get]
  148.  
  149.   XFMiscSetResource $xfW background \
  150.     [.xf${xfClass}Config4.params1.params2.bg.bg get]
  151.   XFMiscSetResource $xfW bitmap \
  152.     [.xf${xfClass}Config4.params1.params2.bitmap.bitmap get]
  153.   XFMiscSetResource $xfW command \
  154.     [XFMiscGetText .xf${xfClass}Config4.params1.params2.command.command.command]
  155.   XFMiscSetResource $xfW font \
  156.     [.xf${xfClass}Config4.params1.params2.font.font get]
  157.   if {$xfConf(kanji)} {
  158.     XFMiscSetResource $xfW kanjifont \
  159.       [.xf${xfClass}Config4.params1.params2.kanjifont.kanjifont get]
  160.   }
  161.   XFMiscSetResource $xfW foreground \
  162.     [.xf${xfClass}Config4.params1.params2.fg.fg get]
  163.   XFMiscSetResource $xfW height \
  164.     [.xf${xfClass}Config4.params1.params2.size.size2.size2 get]
  165.   XFMiscSetResource $xfW text \
  166.     [.xf${xfClass}Config4.params1.params2.text.text get]
  167.   XFMiscSetResource $xfW textvariable \
  168.     [.xf${xfClass}Config4.params1.params2.textvar.textvar get]
  169.   XFMiscSetResource $xfW value \
  170.     [.xf${xfClass}Config4.params1.params2.value.value get]
  171.   XFMiscSetResource $xfW variable \
  172.     [.xf${xfClass}Config4.params1.params2.variable.variable get]
  173.   XFMiscSetResource $xfW width \
  174.     [.xf${xfClass}Config4.params1.params2.size.size1.size1 get]
  175. }
  176.  
  177. # eof
  178.  
  179.